package com.adingxiong.cft.service.impl;

import com.adingxiong.cft.annotate.StrCut;
import com.adingxiong.cft.entity.SysLog;
import com.adingxiong.cft.mapper.SysLogMapper;
import com.adingxiong.cft.service.ISysLogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiongc
 * @since 2020-09-27
 */
@Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements ISysLogService {

    @Override
    @StrCut(value = "methodName",length = 12)
    public Page<SysLog> list(String keywords, Integer pageNum, Integer pageSize) {
        Page<SysLog> page = new Page<>(pageSize,pageNum);
        QueryWrapper<SysLog> wrapper = new QueryWrapper<>();
        if (StringUtils.isNotEmpty(keywords)) {
            wrapper.lambda().like(SysLog::getOperation,keywords);
        }
        return page(page,wrapper);
    }
}
